/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thread;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import view.MainServer_View;

/**
 *
 * @author 马凯
 */
public class MainServer_Thread extends Thread {

    private MainServer_View msv;
    private ServerSocket ss;
    private Socket socket;
    private Server_Thread receiveThread;

    public MainServer_Thread() {
        
        msv = new MainServer_View();
        msv.setVisible(true);

        try {
            ss = new ServerSocket(9000);

            while (true) {
                socket = ss.accept();
                System.out.println("Accept new thread!!");
                receiveThread = new Server_Thread(socket, msv);
                receiveThread.start();
            }
            
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    public static void main(String args[]) {
        new MainServer_Thread();
    }
}
